

<div class="col-md-8">
    <form id="changePasswordForm"  action="{:U('UserCenter/Config/doChangePassword')}" method="post" class="ajax-form form-horizontal">
        <div class="form-group">
            <label for="inputOldPassword" class="col-sm-3 control-label">旧密码</label>

            <div class="col-sm-9">
                <input type="password" class="form-control" id="inputOldPassword" value="" name="old_password" placeholder="输入旧密码">
            </div>
        </div>

        <div class="form-group" style="padding-top:10px">
            <label for="inputNewPassword" class="col-sm-3 control-label">新密码</label>

            <div class="col-sm-9">
                <input type="password" class="form-control" id="inputNewPassword" value="" name="new_password" placeholder="输入新密码">
            </div>
        </div>

        <div class="form-group" style="padding-top:10px">
            <label for="inputConfirmPassword" class="col-sm-3 control-label">确认密码</label>

            <div class="col-sm-9">
                <input type="password" class="form-control" id="inputConfirmPassword" value="" name="confirm_password"" placeholder="输入确认密码">
            </div>
        </div>
        <div class="form-group" style="padding-top:10px">
            <div class="col-sm-offset-3 col-sm-9">
                <p class="text-danger" id="submitTip"></p>
                <button type="submit" class="btn btn-primary">&nbsp;保存&nbsp;</button>
            </div>
        </div>
    </form>
</div>

<block name="script">
    <script>
        //检查两次输入的密码是否一致
        $(function(){
            $('#changePasswordForm').submit(function(e){
                var newPassword = $('#inputNewPassword').val();
                var confirmPassword = $('#inputConfirmPassword').val();
                if(newPassword != confirmPassword) {
                    toast.error('两次输入的密码不一致');
                    e.stopPropagation();
                    return false;
                }
            })
        })
    </script>
</block>